package tech.aistar.mapper.guidemapper;


import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;


import org.apache.ibatis.annotations.Update;
import tech.aistar.entity.authordis.UserTable;
import tech.aistar.entity.daoyou.*;
import tech.aistar.entity.person_center.Orders;
import tech.aistar.vo.daoyou.MyOrders;


import java.sql.Date;
import java.util.List;

public interface Guide {

    //查看个人信息
    @Select("select * from orders where user_id=${value} and order_status=0")
    List<Orders> checkUserBill(Integer id);

//获取点赞数
    @Select("select * from GuidePraise where guide_id =${value}")
    GuidePraise getPrais(Integer guide_id);

//插入点赞
    @Insert("insert into GuidePraise (guide_id) values(${value})")
    void addPraise(Integer id);

//查看导游中的申请表
    @Select("select * from guide_apply where  id=${guideId}")
    GuideApply getByObj(GuideInfo guideInfo);

//   游客首页 获取所有的游客的信息 grade是否下架
    @Select("select * from guide_info where status!=-2")
    List<GuideInfo> getAllPerson();

//通过用户的id 来判断是不是导游 如果是导游然后通过导游申请表中的id 去导游详情表中去查找这个导游详情表的主键id
    @Select("select * from guide_apply where user_id=${value} and apply_status=1")
    GuideApply getApplyById(Integer id);
@Select("select * from guide_info where guide_id=${value}")
GuideInfo getGuideInfoId(Integer id);

//通过导游的id获取订单
    @Select("select * from orders where guide_id=${value} and order_status=2")
    List<Orders> getcomments(Integer id);
//通过用户的id 来获取
    @Select("select * from user_table where id=${value}")
    UserTable getImg(Integer id);
    //获取某一个人的laber
    @Select("select *  from guide_laber where guide_info_id=${value}")
    List<GuideLaber> getLaber(Integer id);

    //获取导游的个人主页的照片
    @Select("select * from guide_photo where guide_id=${value}")
    List<GuidePhoto> getGuidePhotoById(Integer id);

 //分页
    @Select("select * from GuidePage where guide_id =${value}")
    List<GuidePageCommen> getGuideCommen(Integer id);


    //根据id进行查询
    @Select("select  personal_lable from laber where id=${value}")
    String getLaberById(Integer id);


    //通过导游id获取
    @Select("select * from guide_info where status!=-2 and id=${value}")
    GuideInfo getPersonById(Integer id);

    //通过查询用户是
    @Select("select * from user_table where idcard=${value}")
    UserTable getCardById(Integer id);

//通过导游id 查看所有的订单
    @Select("select * from orders where order_status=1 and guide_id = ${value}")
    List<Orders> getALlbill(Integer id);

    //通过导游id查看订单 为了查看是否可以预约导游   有问题
    @Select("select * from orders where order_status=1 and  (play_day< '${play_day}' or  ${endtime}<apply_time) and guide_id = ${id}")
    Orders getOrderById(@Param("id") Integer id, @Param("play_day") Date play_day,@Param("endtime") Date endtime);

    //新建预约导游表
  @Insert("insert into orders(apply_time,orderno,user_id,guide_id,place,phone_number,play_day,apply_name,people_sum,days,order_time,verification) values('${sqlapplyTime}',${orders.orderno},${orders.userId},${orders.guideId},'${orders.place}',${orders.phoneNumber},'${sqlend}','${orders.applyName}',${orders.peopleSum},${orders.days},'${orderTime}',${verification})")
// @Insert("insert into orders(apply_time,orderno,user_id,guide_id,phone_number,play_day,people_sum,days) values('${sqlapplyTime}',${orders.orderno},${orders.userId},${orders.guideId},${orders.phoneNumber},${sqlend},${orders.peopleSum},${orders.days})")
 void  inserOrders(MyOrders myOrders);

  //查看所有没有被接收或者没有核销的账单
    @Select("select * from orders where order_status !=2 and order_status!=-1")
    List<Orders> getNoAcctionOrder();

    //查看照片信息
    @Select("select count(*) from guide_photo where guide_id=${value}")
    Integer getPhoneNum(Integer id);
    //插入信息
    @Insert("insert into guide_photo (guide_id,imgs) values(${id},'${imgs}')")
    void inserPhoto(@Param("id") Integer id,@Param("imgs") String imgs);






}
